<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8"/>
    <title>比赛详情 | 及第竞赛网</title>
    <link rel="stylesheet" href="../css/first.css"/>
    <link rel="stylesheet" href="../css/font-awesome.min.css">

</head>

<body>
<div class="container">
    <header class="header">
        <div class="brand">
            <div class="brand-icon">
                <a href="home.html">
                    <span>及第</span>竞赛网
                </a>
            </div>
        </div>
        <nav class="nav">
            <div class="nav-menu">
                <ul>
                    <li class="nav-btn">
                        <a href="home.html">首页</a>
                    </li>
                    <li class="nav-btn">
                        <a href="noticeOfContest.html">比赛公告</a>
                    </li>
                    <li class="nav-btn">
                        <a href="informationOfContest.html">比赛信息</a>
                    </li>
                    <li class="nav-btn">
                        <a href="newsOfContest.html">比赛资讯</a>
                    </li>
                    <!--<li class="nav-btn">-->
                        <!--<a href="">报名</a>-->
                    <!--</li>-->
                </ul>
            </div>
        </nav>
    </header>
    <section class="content" id="detail">
        <section class="section">
            <div class="section-header" style=" height:auto; text-align: center;">
                <div class="section-title">
                    <h2>{{mydata.title}}</h2>
                    <div style="font-size: 14px;">
                        <span>{{mydata.releaseTime}}　</span>
                        <span>
                        <a  href="javascript:return false;" @click="BM(mydata.mode,mydata.deId)" >　点击报名>></a>
                    </span>
                    </div>
                </div>
            </div>
            <div class="section-body" style="line-height: 2.4rem">
                <ul>
                    <li>
                        <h3>比赛详细内容</h3>
                        <article v-html="mydata.content" style="text-align: justify">

                        </article>
                    </li>
                    <li>
                        <h3>主办单位</h3>
                        <article>{{mydata.coName}}</article>
                    </li>
                    <li>
                        <h3>参与方式</h3>
                        <article>{{mydata.mode}}</article>
                    </li>
                    <li>
                        <h3>比赛类型</h3>
                        <article>{{copylaName}}</article>
                    </li>
                    <li>
                        <h3>联系人</h3>
                        <article>{{mydata.contacts}}</article>
                    </li>
                    <li>
                        <h3>联系电话</h3>
                        <article>{{mydata.phone}}</article>
                    </li>
                    <li>
                        <h3>报名时间段</h3>
                        <article>{{mydata.enrollTime}}</article>
                    </li>
                    <li>
                        <h3>比赛时间段</h3>
                        <article>{{mydata.startTime}}</article>
                    </li>

                </ul>
            </div>
        </section>
    </section>
</div>
<footer class="footer">
    <p>Copyright © 2018-2019 JIDI All rights reserved.</p>
</footer>


<script type="text/javascript" src="../js/vue.min.js"></script>
<script type="text/javascript" src="../js/axios.min.js"></script>
<script type="text/javascript" src="../js/cookieUtil.js"></script>
<script type="text/javascript" src="../js/gettype.js"></script>

<script type="text/javascript">
    var url1 = "http://donting.free.idcfengye.com";
    var cp = new Vue({

        el: '#detail',
        data: {
            mydata: {}, //信息
            deId: '',
            comId: '', //类型id
            types: [], //类型列表
            copylaName :'',  //id转名字

        },
        methods: {
            //报名按钮
            BM:function(mode,deId){
                if (mode=="团队") {
                    setCookie('deId',deId,1);
                    document.location = "enterOfTeam.html";
                }
                else if (mode=="个人"){
                    setCookie('deId',deId,1);
                    document.location = "enterOfPerson.html"
                }
            },

            //获取一条比赛信息
            getOneMatch: function (deId) {
                console.log(deId);
                axios.defaults.withCredentials = true;
                axios.get(url1 + '/details/findOne', {
                    params: {
                        'deId': deId,
                    }
                }).then(function (response) {
                    var rs = response.data;

                    if (rs.code == 200) {
                        cp.mydata = rs.data[0];

                        console.log(cp.types.length+"---cp.types.length");

                        for (var j = 0; j < cp.types.length; j++) {
                            console.log(cp.mydata.comId+"---types.comId");

                            if (cp.mydata.comId == cp.types[j].comId) {
                                cp.copylaName = cp.types[j].laName;
                                console.log(cp.copylaName + "---laName");
                                return ;

                            }
                        }



                        console.log(cp.mydata.coName+"---cp.mydata.coName");


                        console.log("获取比赛成功");
                    } else {
                        console.log("获取比赛失败");
                    }

                }).catch(function (error) {
                    console.log("获取比赛连接超时！"+error);
                });
            },


        },
        mounted() {
            GetType(this);
            this.deId = getCookie("deId");
            this.getOneMatch(this.deId);

        }

    })
</script>


</body>

</html>